import React from 'react'
import Child from './child1'
import ChildS from './child2'

export default class Parent extends React.Component{
    constructor(){
        super()
        this.state={
            money:1,
            value:''
        }
    }
    changeValue = (e)=>{
        this.setState({
            money:e.target.value,
        })
    }
    render(){
        return(
            <div>
               {/* <Child /> */}
               <p>父</p>
               <div>
                   <input value = {this.state.money} type="text" onChange={this.changeValue.bind(this)} />
               </div>
               <div>
                   子1：<Child money={this.state.money}></Child>
               </div>
               <div>
                   子2：<ChildS money={this.state.money}></ChildS>
               </div>
            </div>
        )
    }
}